package com.idroid.widget;

import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.idroid.R;


/**
 * @author bichuanfeng
 * @date 2016-12-1
 */
public class LoadDialog extends Dialog {
    private ImageView spaceshipImage;
    public LoadDialog(Context context) {
        this(context, null);
    }

    public LoadDialog(Context context, String msg) {
        super(context, R.style.loading_dialog_new);
        LayoutInflater inflater = LayoutInflater.from(context);
        View v = inflater.inflate(R.layout.loading_dialog_new, new LinearLayout(context), false);// 得到加载view
        RelativeLayout layout = (RelativeLayout) v.findViewById(R.id.dialog_view);// 加载布局
        // main.xml中的ImageView
        //spaceshipImage = (ImageView) v.findViewById(R.id.img);
        //动画效果
       /* AnimationDrawable animationDrawable = (AnimationDrawable) spaceshipImage.getDrawable();
        animationDrawable.start();*/
        setCancelable(true);// 不可以用“返回键”取消
        setContentView(layout, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));// 设置布局
    }

    @Override
    public void show() {
        super.show();
    }

}
